/***************************************************************************
 *   Copyright (C) 2008 - 2009 by Pavel Andreev                            *
 *   Mail: apavelm on gmail point com (apavelm@gmail.com)                  *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 3 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#include "openmergedialog.h"

OpenMergeDialog::OpenMergeDialog( QWidget * parent ) : QDialog(parent)
{
	setupUi(this);
	connect (btnBox, SIGNAL(accepted()), this, SLOT(slotAccept()));
	connect (btnLeftBrowse, SIGNAL(clicked()), this, SLOT(slotLeftClick()));
	connect (btnRightBrowse, SIGNAL(clicked()), this, SLOT(slotRightClick()));
	connect (btnLeftDir, SIGNAL(clicked()), this, SLOT(slotLeftDirClick()));
	connect (btnRightDir, SIGNAL(clicked()), this, SLOT(slotRightDirClick()));
	connect (btnFilterBrowse, SIGNAL(clicked()), this, SLOT(slotFilterClick()));
}

void OpenMergeDialog::slotAccept()
{
	emit OnOk(edtLeft->text(), edtRight->text(), edtFilter->text(), chkRecursive->checkState() == Qt::Checked );
	QDialog::accept();
}

void OpenMergeDialog::slotLeftClick()
{
	QString text = QFileDialog::getOpenFileName(this, QObject::tr("Open..."), edtLeft->text(), QObject::tr("Any Files (*.*)"));
	edtLeft->setText(text);
}

void OpenMergeDialog::slotRightClick()
{
	QString text = QFileDialog::getOpenFileName(this, QObject::tr("Open..."), edtRight->text(), QObject::tr("Any Files (*.*)"));
	edtRight->setText(text);
}

void OpenMergeDialog::slotLeftDirClick()
{
	QString text = QFileDialog::getExistingDirectory(this, QObject::tr("Open directory..."), edtLeft->text() );
	edtLeft->setText(text);
}

void OpenMergeDialog::slotRightDirClick()
{
	QString text = QFileDialog::getExistingDirectory(this, QObject::tr("Open directory..."), edtRight->text() );
	edtRight->setText(text);
}

void OpenMergeDialog::slotFilterClick()
{
	
}

